home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Pane2 / c / AddMain next >
Text File  |  1995-08-23  |  2KB  |  74 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Pane2.AddMain.c
  12.     Author:  Copyright © 1995 Andrew Sellors.
  13.     Version: 1.04 (4th August 1995)
  14.     Purpose: Handles windows with panes.
  15. */
  16.  
  17. #include "DeskLib:Pane2.h"
  18. #include "Pane2Defs.h"
  19. #include "Desklib:Event.h"
  20. #include "DeskLib:Template.h"
  21. #include "Desklib:EventMsg.h"
  22. #include "Desklib:Error.h"
  23.  
  24. #include <stdlib.h>
  25.  
  26.  
  27. /******************************************************************************/
  28.  
  29. extern BOOL Pane2_AddMain(window_handle mainwindow)
  30. {
  31.  /*
  32.   * initialises 'mainwindow' with the library as a main window that can have
  33.   * panes attached to it.
  34.   */
  35.   main_listelement *mainelement;
  36.  
  37.  /*
  38.   * malloc memory for list element and return FALSE if fails
  39.   */
  40.   mainelement = malloc(sizeof(main_listelement));
  41.   if(mainelement == NULL)
  42.      return(FALSE); /* failed */
  43.  
  44.  /*
  45.   * initialise list headers
  46.   */
  47.   LinkList_Init(&(mainelement->header));
  48.   LinkList_Init(&(mainelement->paneanchor));
  49.  
  50.  /*
  51.   * add main window handle to list element
  52.   */
  53.   mainelement->mainwindow = mainwindow;
  54.   mainelement->invalideventdata = FALSE;
  55.  
  56.  /*
  57.   * add list element to end of list
  58.   */
  59.   LinkList_AddToTail(&main_anchor, &(mainelement->header));
  60.  
  61.  /*
  62.   * install open window event handler for main window
  63.   */
  64.   Event_Claim(event_OPEN, mainwindow, event_ANY, OpenEventHandler, mainelement);
  65.  
  66.  /*
  67.   * install message handler on mode change so that main window is opened before
  68.   * status is read so that panes open in correct place
  69.   */
  70.   EventMsg_Claim(message_MODECHANGE, event_ANY, ModeChangeMessageHandler, mainelement);
  71.  
  72.   return(TRUE);
  73. }
  74.